package jtk.project4.fleet.field;

import java.awt.FlowLayout;

import jtk.project4.fleet.domain.Employee;
import nl.coderight.jazz.form.FormField;
import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.FormLayout.Resize;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.ComboField;
import nl.coderight.jazz.form.field.NumberField;
import nl.coderight.jazz.form.field.SelectField;
import nl.coderight.jazz.form.field.TableField;
import nl.coderight.jazz.form.field.TextField;
import nl.coderight.jazz.form.field.button.CheckButton;
import nl.coderight.jazz.form.field.button.PushButton;
import nl.coderight.jazz.form.field.table.TableFieldColumn;

public class EmployeeExpirationsTableField extends GroupControl<Employee> {
	private TableField expirationsTableField;
	private PushButton addExpirationsPushButton;
	private PushButton editExpirationsPushButton;
	private PushButton deleteExpirationsPushButton;
	private CheckButton check;
	
	public EmployeeExpirationsTableField(String bindID){
		//setTitle("header.generalinformation");
		setBindID(bindID);
		createFields();
		createLayout();
	}

	private void createFields() {
		expirationsTableField = new TableField("","");
			expirationsTableField.addColumn("label.expirationsName","");
			expirationsTableField.addColumn("label.issued","");
			expirationsTableField.addColumn("label.expires","");
			expirationsTableField.addColumn("label.notes","");
		
			
		addExpirationsPushButton = new PushButton("Add");
		editExpirationsPushButton = new PushButton("Edit");
		deleteExpirationsPushButton = new PushButton("Delete");
		
		/*check = new CheckButton("read only check Button");
			check.setEnabled(isReadonly());*/
	}
	
	private GroupControl createButtonsFields() {
		GroupControl buttons = new GroupControl();
		buttons.setLayout(new FlowLayout(FlowLayout.LEFT));
		buttons.addField(addExpirationsPushButton);
		buttons.addField(editExpirationsPushButton);
		buttons.addField(deleteExpirationsPushButton);
		//buttons.addField(check);
		return buttons;
	}
	
	private void createLayout() {
		// TODO Auto-generated method stub
		setLayout(new FormLayout())
		.addField(expirationsTableField)
		.addRow()
		.addField(createButtonsFields())
		
		;	
	}
}
